# Maintainer: Carlos Antunes <cmantunes@gmail.com>
# Contributor: Renato Silva <br.renatosilva@gmail.com>

pkgname="lemon"
pkgver=3.8.7.0
pkgrel=3
pkgdesc="The LEMON LALR Parser Generator used in SQLite $pkgver (MSYS2)"
arch=('i686' 'x86_64')
license=(PublicDomain)
groups=('base-devel')
url="http://www.sqlite.org"
depends=("gcc-libs")
source=("lemon.c"
        "lempar.c"
        "0010-lemon-share.patch")
md5sums=('b125165f7ccc2318ec2e33cb19197f7e'
         'fbf6255b88d54cf284c833da0d9ee5d2'
         '776628b1b53f64d80bfc3edb20f1d803')
options=("staticlibs")

prepare() {
  cd "${srcdir}"
  patch -Np0 -i ${srcdir}/0010-lemon-share.patch
}

build() {
  make lemon
}

package() {
  install -Dm755 lemon ${pkgdir}/usr/bin/lemon
  install -Dm644 lempar.c ${pkgdir}/usr/share/lemon/lempar.c
  mkdir -p "${pkgdir}/usr/share/licenses/${pkgname}"
  echo "This package is under public domain." > "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
